<template>
  <el-header class="hui-header">
    <template v-if="type === 'custom' || title">
      <div class="hui-header__title">
        <slot>{{ title }}</slot>
      </div>
    </template>
    <el-breadcrumb separator-class="el-icon-arrow-right" v-else>
      <el-breadcrumb-item v-for="item in $route.matched" :key="item.component" :to="item.path">{{ item.name }}</el-breadcrumb-item>
    </el-breadcrumb>
  </el-header>
</template>

<script>
export default {
  name: 'hpro-header',
  componentName: 'hpro-header',
  props: {
    type: {
      type: String,
      validator (value) {
        return [
          'custom',
          'breadcrumb'
        ].indexOf(value) > -1
      },
      default: 'breadcrumb'
    },
    title: String
  }
}
</script>

<style lang="less">
  @import "../../common/h-theme/_variable";
  .hui-header {
    display: flex;
    flex: none;
    align-items: center;
    border-bottom: @--border-base;
    background-color: @--background-color-base;
  }

  .hui-header__title {
    width: 100%;
    text-align: center;
    font-weight: 700;
    font-size: @--font-size-base;
  }
</style>
